Image encoding apparatus, image encoding method, image decoding apparatus, and image decoding method

ABSTRACT

The present invention provides an image encoding/decoding technique that is capable of achieving the higher compression efficiency. An image encoding method comprises: an intra prediction step which performs intra prediction on a block basis to generate a predicted image; a subtraction step which calculates the difference in prediction between the predicted image generated by the intra prediction step and an original image; a frequency conversion step which performs frequency conversion processing for the difference in prediction; a quantization step which subjects the output of the frequency conversion step to quantization processing; and a variable-length encoding step which subjects the output of the quantization step to variable-length encoding processing; wherein the intra prediction encoding step predicts a target pixel to be encoded by use of pixel values of two reference pixels between which the target pixel to be encoded is located.

CLAIM OF PRIORITY

The present application is a continuation application of Ser. No.14/519,332, filed Oct. 21, 2014, which is a continuation application ofSer. No. 12/248,945, filed Oct. 10, 2008, now U.S. Pat. No. 8,867,626,which claims priority from Japanese patent application serial no. JP2007-263888, filed on Oct. 10, 2007, the content of which is herebyincorporated by reference into this application.

BACKGROUND OF THE INVENTION

(1) Field of the Invention

The present invention relates to moving image encoding techniques forencoding a moving image.

(2) Description of the Related Art

Encoding methods including MPEG (Moving Picture Experts Group) methodhave been drafted as techniques for converting a large amount of movingimage information into digital data to write and transfer the digitaldata. Such encoding methods include MPEG-1 standards, MPEG-2 standards,MPEG-4 standards, and H.264/AVC (Advanced Video Coding) standards andare used as international standard encoding methods.

According to the above-described standards, information about an imagewhose encoding processing has been completed is used to predict, on ablock basis, a target image to be encoded. Then, by encoding thedifference in prediction between the target image and an original image,the redundancy of the moving image is eliminated to reduce the encodingamount. In particular, according to the H.264/AVC standards, a drasticimprovement in compression ratio is achieved by adopting the intraprediction encoding method that uses pixels surrounding a target blockto be encoded.

However, when the intra prediction according to the H.264/AVC standardsis executed, a prediction method thereof is too simple to achieve thesufficient prediction accuracy. For example, the intra prediction basedon the H.264/AVC standards adopts a unidirectional prediction method inwhich only one reference pixel is specified so that all pixels in aprediction direction are predicted by use of a pixel value of only onereference pixel as a reference value. Accordingly, there was room for animprovement in prediction accuracy. Therefore, an intra encodingtechnique, which is capable of improving the accuracy of intraprediction to increase a compression ratio, is required.

As a technique for improving the accuracy in intra prediction, forexample, JP-A-2006-352181 discloses that kinds of pixels which can beused for intra prediction are increased by enabling inverting of thewhole image before encoding it.

In addition, nonpatent literature 1 discloses a technique in whichprediction is performed by use of blocks existing on the upper and lowerand right and left sides by changing the order of encoding on a blockbasis.

Nonpatent literature 1: “Block Based Extra/Interpolating Prediction forIntra Coding” T. Shiodera, A. Tanizawa, T. Chujoh, PCSJ2006, November,2006.

SUMMARY OF THE INVENTION

However, according to JP-A-2006-352181, unidirectional prediction issimply performed by using a pixel value of only one reference pixel as areference value like in the H.264/AVC standards after the image isinverted. Therefore, it is not possible to further improve theprediction accuracy.

In addition, according to the nonpatent literature 1, the number ofblocks, each of which can be predicted by use of blocks existing on theupper and lower and right and left sides, is limited. Therefore, theprediction accuracy of blocks other than these predictable blocksdecreases in comparison with that in the case of the H.264/AVCstandards.

The problem with the above conventional techniques is that, for example,when a luminance value largely changes in a prediction direction, thedifference in predicted value becomes larger, which causes the encodingamount to increase, resulting in a reduction in compression ratio.

The present invention has been made taking the above-described probleminto consideration, and an object of the present invention is to providean image encoding/decoding technique that is capable of achieving thehigher compression efficiency.

BRIEF DESCRIPTION OF THE INVENTION

These and other features, objects and advantages of the presentinvention will become apparent from the following description when takenin conjunction with the accompanying drawings wherein:

FIG. 1 is a diagram illustrating an image encoding apparatus accordingto one embodiment of the present invention;

FIG. 2 is a diagram illustrating an image decoding apparatus accordingto one embodiment of the present invention;

FIG. 3 is a diagram illustrating intra prediction encoding processingused in the H.264/AVC standards;

FIG. 4 is a diagram illustrating intra prediction encoding processingaccording to one embodiment of the present invention;

FIG. 5 is a diagram illustrating intra prediction encoding processingaccording to one embodiment of the present invention;

FIG. 6 is a diagram illustrating intra prediction decoding processingused in the H.264/AVC standards;

FIG. 7 is a diagram illustrating intra prediction decoding processingaccording to one embodiment of the present invention;

FIG. 8 is a diagram illustrating intra prediction decoding processingaccording to one embodiment of the present invention;

FIG. 9 is a diagram illustrating intra prediction used in the H.264/AVCstandards;

FIG. 10 is a diagram illustrating intra prediction according to oneembodiment of the present invention;

FIG. 11 is a diagram illustrating intra prediction according to oneembodiment of the present invention;

FIG. 12 is a flowchart illustrating an image encoding apparatusaccording to one embodiment of the present invention;

FIG. 13 is a flowchart illustrating in detail an image encodingapparatus according to one embodiment of the present invention;

FIG. 14 is a flowchart illustrating an image decoding apparatusaccording to one embodiment of the present invention;

FIG. 15 is a flowchart illustrating in detail an image decodingapparatus according to one embodiment of the present invention;

FIG. 16 is a diagram illustrating one embodiment of the presentinvention;

FIG. 17 is a diagram illustrating a prediction method that differs fromthe intra prediction according to one embodiment of the presentinvention;

FIG. 18 is a diagram illustrating a configuration example of an encodedstream according to one embodiment of the present invention; and

FIG. 19 is a diagram illustrating a configuration example of an encodedstream according to one embodiment of the present invention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT

Embodiments of the present invention will be described below withreference to the accompanying drawings.

Each element designated by the same reference numeral in the drawingshas substantially the same function.

“the sum of pixels” in the description and drawings of thisspecification expresses a result obtained by adding pixel values.

First of all, the operation of intra prediction encoding processingbased on the H.264/AVC standards will be described with reference toFIG. 3. In the case of the H.264/AVC standards, a target image to beencoded is encoded in the order of raster scanning (301). Incidentally,in general, the order of raster scanning means that processing isperformed from the top left end of a screen to the right end, and thenthe processing is performed from the bottom left end of the screen tothe right end, and this series of processing is repeated.

Here, each pixel of a target block to be encoded is predicted by using apixel value of a decoded image in each of encoded blocks that areadjacent to the target block to be encoded on the left, upper left,upper, and upper right sides of the target block.

In particular, a pixel value of one pixel selected from among 13 pixelsin the encoded blocks shown in FIG. 3 is used as a reference value. Allpixels which are in alignment with the same straight line in aprediction direction from the one pixel (a start point) are predicted byreferring to the pixel value of the one pixel as the reference value(302).

For example, as shown with reference numeral 303, all of pixels B, C, D,E of the target block to be encoded are subjected to prediction encodingwith reference to the same pixel. Next, difference values (difference inprediction) b, c, d, e from a value A′, which has been obtained bydecoding a pixel directly above the pixel B, are calculated. Moreover,in the case of the H.264/AVC standards, the most suitable predictiondirection candidate can be selected from among eight kinds of predictiondirection candidates (for example, vertical, horizontal, and diagonal)on a block basis, so that value of the difference in prediction, and avalue of the prediction direction are encoded. It should be noted that,according to the H.264/AVC standards, it is possible to use “DCprediction” that predicts all pixels included in a target block to beencoded on the basis of an average value of reference pixels (304) inaddition to the prediction in the specific direction.

Next, the operation of intra prediction decoding processing based on theH.264/AVC standards will be described with reference to FIG. 6. Similarto the encoding processing, decoding processing is also executed in theorder of raster scanning (601). A pixel value of a decoded image iscalculated by use of a decoded reference pixel and the difference inprediction. To be more specific, a decoded image is acquired by addingthe difference in prediction to the reference pixel in a predictiondirection.

For example, in reference numeral 602, by adding difference inprediction values b′, c′, d′, e′ of a target block to be decoded (valuesobtained by decoding b, c, d, e shown in FIG. 3 respectively, the valuesincluding a quantization error) to the decoded reference pixel A′respectively, decoded pixels B′, C′, D′, E′ (decoded pixels for B, C, D,E shown in FIG. 3) are acquired respectively.

As described above, the intra prediction encoding processing based onthe H.264/AVC adopts a simple unidirectional method in which only onereference pixel is specified to predict all pixels in a predictiondirection by a value of the reference pixel.

FIG. 9 is a conceptual diagram illustrating intra prediction encodingbased on the H.264/AVC standards. Here, a horizontal axis indicatescoordinate values in a target block in a prediction direction; and avertical axis indicates a pixel value (luminance value) in thecoordinates. Accordingly, a curve in a graph expresses a luminance curvein a target block. As previously described, according to the H.264/AVCstandards, blocks which can be referred to when intra prediction isperformed are limited to blocks located on the left and upper sides of atarget block. The H.264/AVC standards, therefore, adopt a method inwhich a reference pixel is copied in one direction. In this case, asindicated with reference numeral 901, if a luminance gradient in thetarget block is gentle, there is a higher possibility that predictionwill come true. Accordingly, the difference in prediction decreases.However, as indicated with reference numeral 902, if the luminancegradient is steep, the difference in prediction increases with theincrease in distance from the reference pixel, which results in anincrease in the encoding amount.

FIG. 10 is a conceptual diagram illustrating intra prediction encodingaccording to this embodiment. In order to solve the above problemaccompanied by the H.264/AVC standards, in this embodiment, as indicatedwith reference numeral 1001, a pixel located at a boundary of a targetblock is used as a new reference pixel (reference pixel 2) such thatthat prediction is performed in combination with a usual reference pixel(reference pixel 1). Specifically, two reference pixels (the referencepixel 1 and the reference pixel 2), both of which are located on astraight line passing through the target block, are selected. A value ofa pixel located between these reference pixels is then predicted byinterpolation processing based on interpolative prediction that uses thetwo reference pixels. This makes it possible to increase the predictionaccuracy particularly for a block whose luminance gradient is steep andto reduce the number of prediction errors.

However, similar to the H.264/AVC standards, if encoding is performed inthe order of raster scanning, in many cases a value of only one(reference pixel 1) of two reference pixels located at a boundary of atarget block can be acquired. For this reason, the method according tothe present application predicts a value of the other reference pixel(reference pixel 2) from a pixel value included in a surrounding encodedblock.

To be more specific, according to this embodiment, if the referencepixel 1 and the reference pixel 2 can be selected from among encodedpixels, they are selected from among the encoded pixels. Here, if thereference pixel 2 cannot be selected from among the encoded pixels, thereference pixel 2 is predicted from the encoded pixels in advance. Afterthat, as shown in FIG. 10, the prediction is performed by theinterpolation processing based on the interpolative prediction that usesthe two reference pixels.

As a result, even if one of the two reference pixels is not an encodedpixel, the prediction accuracy for a block whose luminance gradient issteep can be increased, and accordingly, the number of prediction errorscan be reduced.

FIG. 4 is a diagram conceptually illustrating an operation example ofintra prediction encoding processing according to this embodiment. Alsoin this case, a target image to be encoded is encoded in the order ofraster scanning, and the prediction is performed by referring to encodedblocks that are adjacent to a target block on the left, upper left,upper, and upper right sides of the target block. Reference numeral 401denotes intra prediction encoding steps in a vertical direction. Here,prediction is executed by two steps as follows: a step 1—prediction of apixel located at a boundary of a target block (for example, a referencepixel 2 in (1001)) and the calculation of the difference in prediction;and a step 2—bidirectional prediction using reference pixels located atboth ends of a target block.

In the step 1, two reference pixels used for the bidirectionalprediction are selected. Here, if a reference pixel cannot be selectedfrom among encoded pixels, the reference pixel is predicted based onsurrounding encoded blocks. For example, with reference to referencenumeral 402, values E, F, G, H of pixels located in the lowermost row ofa target block are predicted by an average value Z of four decodedpixels A′, B′, C′, D′ located in the same row of a block that isadjacent to the target block on the left side of the target block.Concurrently, difference values of the difference between Z and the fourpixels are encoded as difference in prediction values e, f, g, hrespectively.

Next, in the step 2, other pixel values included in the target block arepredicted by performing interpolation processing based on theinterpolative prediction that uses the two reference pixels selected orpredicted in the step 1. For example, with reference to referencenumeral 403, pixels J, K, L each belonging to the same column in thetarget block are predicted by linear interpolation that uses a referencepixel I′ and a value of Z predicted in the step 1, and therebydifference in prediction values j, k, l are calculated. Moreover, thesedifference in prediction values are encoded.

FIG. 7 is a diagram conceptually illustrating an operation example ofintra prediction decoding processing according to this embodiment.Decoding can be made by executing steps reverse to those shown in FIG. 4(701). First of all, an adjacent block located on the left side of thetarget block is used to calculate the reference pixel Z (702), and thereference pixel Z is then added to the difference in prediction valuese′, f′, g′, h′ of pixels located at the boundary of the target block soas to acquire decoded images E′, F′, G′, H′ respectively. Subsequently,each pixel included in the target block is predicted (703) by thereference pixel I′ included in an adjacent block located on the upperside of the target block, and by the linear interpolation based on theinterpolative prediction of the value Z predicted by the aboveprocessing. Each predicted pixel is then added to difference inprediction values j′, k′, I′ to acquire decoded pixels J′, K′, L′respectively.

In the case of the intra prediction shown in FIG. 4, the methodaccording to the present application cannot be applied to blocks locatedat the end of a screen because the adjacent blocks located on the leftand upper sides of the target pixel are used to predict one of thereference pixels. Accordingly, the bidirectional prediction according tothis embodiment can be applied to the blocks located at the end of thescreen by performing intra prediction encoding, for example, accordingto steps shown in FIG. 5 (501). To be more specific, in the step 1 (theprediction of pixels located at the boundary of the target block, andthe calculation of the difference in prediction), the extrapolativeprediction is performed by use of decoded values A′, D′ of two pixelslocated at both ends of an adjacent block located on the upper side ofthe target block to predict a pixel H located at a boundary of the samecolumn included in the target block. Then the difference h between apixel value H and a predicted value Z is encoded as the difference inprediction (502).

Next, in the step 2 (the bidirectional prediction using reference pixelslocated at both ends of the target block), pixels E, F, G each belongingto the same column in the target block are predicted by performinglinear interpolation based on the interpolative prediction that uses Zpredicted in the step 1 as well as the reference pixel D′, and thendifference in prediction values e, f, g are encoded (503). That is, thestep 1 of the intra prediction processing used for blocks located at theend of the screen differs in comparison with the other cases (shown inFIG. 4).

Even if an adjacent block located on the left side of the target blockcannot be used, the bidirectional prediction according to thisembodiment can be achieved by using the above step for the blockslocated at the end of the screen. In this case, decoding can beperformed by use of steps shown in FIG. 8. To be more specific, decodingcan be made by executing steps reverse to those shown in FIG. 5 (801).First, an adjacent block located on the upper side of the target blockis used to calculate the reference pixel Z (802), and the referencepixel Z is then added to a difference in prediction value h′ of a pixellocated at the boundary of the target block so as to acquire a decodedimage H. Subsequently, each pixel included in the target block ispredicted (903) by the reference pixel D′ included in an adjacent blocklocated on the upper side of the target block, and by the linearinterpolation using the value Z predicted by the above processing. Eachpredicted pixel is then added to difference in prediction values e′, f′,g′ to acquire decoded pixels E′, F′, G′ respectively.

Even in the case of the method according to the present application, aprediction method can be selected from among a plurality of candidates.For example, one of eight kinds of prediction directions other than DCprediction can be selected from among nine prediction methods (1101)used in the H.264/AVC standards shown in FIG. 11. For example, whenprediction is performed in a horizontal direction (predictiondirection 1) (1102), for blocks other than blocks located at the end ofa screen, a pixel belonging to the rightmost column of a target block ispredicted by use of an adjacent block located on the upper side of thetarget block. The predicted pixel is then used as one of referencepixels to perform the bidirectional prediction.

In addition, when prediction is performed in a diagonal direction asindicated with a prediction direction 4 (1103), a pixel belonging to therightmost column of the target block, and a pixel belonging to thelowermost line of the target block, are predicted from adjacent blockslocated on the upper and left sides of the target block respectively soas to achieve the bidirectional prediction. On the other hand, for theblocks located at the end of the screen, for example, when prediction isperformed in the horizontal direction (prediction direction 1) (1104),an adjacent block located on the left side of the target block is usedto predict a pixel value belonging to the leftmost column of the targetblock so as to achieve the bidirectional prediction. Moreover, in thecase of a prediction direction 7 (1105), an adjacent block located onthe upper side of the target block is used to predict a pixel valuebelonging to the lowermost column of the target block so as to achievethe bidirectional prediction. In this case, even if adjacent blockslocated on the upper and left sides cannot be used, the use of the stepsof (1104) and (1105) makes it possible to achieve the bidirectionalprediction according to this embodiment.

If the prediction encoding technique according to this embodiment isused in combination with the conventional technologies, a highcompression ratio can be achieved in response to characteristics of animage. For example, encoding which is suitable for characteristics ofthe image can be made by appropriately using, on a block basis, thetechnique according to the present invention and the conventionaltechniques in performing encoding prediction. The conventionaltechniques which are effective include, for example, the intraprediction encoding method (decoding method) based on the H.264/AVCstandards shown in FIG. 3 (FIG. 6), and the inter prediction method thatis also used in the H.264/AVC standards (prediction method referring toan image that differs from a target image to be encoded).

FIG. 1 is a diagram illustrating one embodiment of a moving imageencoding apparatus according to the present invention. The moving imageencoding apparatus includes: an input image memory 102 for storing aninputted original image 101; a block dividing unit 103 for dividing aninput image into small areas; and a motion estimating unit 104 fordetecting motion on a block basis. The moving image encoding apparatusfurther includes: an old intra prediction unit 105 for performing intraprediction processing on a block basis according to steps other thanthose of this embodiment (for example, according to the intra predictionbased on the H.264/AVC standards (shown in FIG. 3)); a new intraprediction unit 106 for performing intra prediction according to thisembodiment on a block basis (shown in FIGS. 4, 5); and an interprediction unit 107 for performing inter prediction on a block basis onthe basis of the amount of motion estimated by the motion estimatingunit 10. The moving image encoding apparatus further includes: a modeselector 108 for determining prediction encoding means (a predictionmethod and the block size) that suit characteristics of an image; asubtraction unit 109 for calculating difference in prediction; afrequency converter 110 and a quantization unit 111 that encode thedifference in prediction; a variable-length encoding unit 112 forperforming encoding according to the probability of occurrence of asymbol; a reverse quantization processor 113 and a reverse frequencyconverter 114 that decode the difference in prediction which has beenencoded; an adder 115 for generating a decoded image by use of thedecoded difference in prediction; and a reference image memory 116 forstoring a decoded image so that the decoded image is used for theprediction thereafter.

The input image memory 102 stores, as a target image to be encoded, oneimage selected from among original images 101. The target image isdivided into small blocks by the block dividing unit 103. The smallblocks are then sent to the motion estimating unit 104, the old intraprediction unit 105, and the new intra prediction unit 106. The motionestimating unit 104 calculates the amount of motion of a particularblock by use of a decoded image stored in the reference image memory116, and then sends the calculated amount of motion to the interprediction unit 107 as a motion vector. The old intra prediction unit105, the new intra prediction unit 106, and the inter prediction unit107 executes intra prediction processing and inter prediction processingon a block basis using several kinds of block size. The mode selector108 selects the most suitable prediction encoding means. Next, thesubtraction unit 109 generates the difference in prediction from theoutput by the most suitable prediction encoding means, and then sendsthe difference in prediction to the frequency converter 110. Thefrequency converter 110 and the quantization processor 111 perform, on ablock basis using the specified block size, the frequency conversion andquantization processing (for example, DCT (Discrete CosineTransformation)) for the difference in prediction that has been sent.The result of the frequency conversion and quantization processing issent to the variable-length encoding unit 112 and the reversequantization processor 113. Moreover, in the variable-length encodingunit 112, not only information about the difference in prediction, whichis expressed by a frequency conversion coefficient, but also informationrequired for prediction encoding (including, for example, a predictiondirection in intra prediction encoding, and a motion vector in interprediction encoding), is subjected to variable-length encoding on thebasis of the probability of occurrence of a symbol so that an encodedstream is generated.

In addition, in the reverse quantization processor 113 and the reversefrequency converter 114, a frequency conversion coefficient subjected toquantization undergoes reverse frequency conversion such as reversequantization and IDCT (Inverse DCT) such that the difference inprediction is acquired. The difference in prediction is then transmittedto the adder 115. Next, the adder 115 generates a decoded image, whichis then stored in the reference image memory 116.

FIG. 2 is a diagram illustrating one embodiment of a moving imagedecoding apparatus according to the present invention. The moving imagedecoding apparatus includes: a variable-length decoder 202 for,according to steps reverse to those of the variable-length encoding,performing decoding of an encoded stream 201 generated by, for example,the moving image encoding apparatus shown in FIG. 1; and a reversequantization processor 203 and a reverse frequency converter 204 thatdecode the difference in prediction. The moving image decoding apparatusfurther includes: an old intra prediction unit 205 for performing intraprediction processing according to steps other than those of thisembodiment (for example, according to the intra prediction based on theH.264/AVC standards (shown in FIG. 6)); a new intra prediction unit 206for performing intra prediction according to this embodiment (shown inFIGS. 7, 8); an inter prediction unit 207 for performing intraprediction; an adder 208 for acquiring a decoded image; and a referenceimage memory 209 for temporarily storing the decoded image.

The variable-length decoder 202 decodes a encoded stream 201 invariable-length to acquire a frequency conversion coefficient componentof the difference in prediction, and information required for predictionprocessing including a prediction direction or a motion vector. Theformer, which is the information about the difference in prediction, istransmitted to the reverse quantization processor 203. The latter, whichis the information required for the prediction processing, istransmitted to the old intra prediction unit 205, the new intraprediction unit 206, or the inter prediction unit 207 in response toprediction means. Next, in the reverse quantization processor 203 andthe reverse frequency converter 204, the information about thedifference in prediction is subjected to reverse quantization andreverse frequency conversion respectively such that the informationabout the difference in prediction is decoded. On the other hand, in theold intra prediction unit 205, the new intra prediction unit 206, or theinter prediction unit 206, the prediction processing is executed withreference to the reference image memory 209 on the basis of informationtransmitted from the variable-length decoder 202 to allow the adder 208to generate a decoded image, which is then stored in the reference imagememory 209.

FIG. 12 is a flowchart illustrating how to encode one frame by theencode processing of the moving image encoding apparatus shown in FIG. 1according to the embodiment of the present invention. First, all blocksexisting in a target frame to be encoded (step 1201) are subjected tothe following processing. To be more specific, each block is subjectedto prediction encoding processing in each of all encoding modes (that isto say, a combination of a prediction method and the block size)beforehand to calculate the difference in prediction. After that, ablock whose encoding efficiency is the highest is selected from amongthe calculated values of the difference in prediction. A predictionprocessing method will be described as below. In addition to the methoddescribed in this embodiment (hereinafter referred to as “new intraprediction encoding processing” (step 1205)), for example, the intraprediction method adopted in the H.264/AVC standards (hereinafterreferred to as “old intra prediction encode processing” (step 1206)),and inter prediction encoding processing (step 1207) are executed. Byselecting the most suitable mode from among them, efficient encoding canbe performed in response to characteristics of an image. When anencoding mode whose encoding efficiency is high is selected from amongthe large number of encoding modes described above (step 1208), the useof the RD-Optimization method enables efficient encoding. TheRD-Optimization method is used to determine the most suitable encodingmode on the basis of, for example, the relationship between thedistortion in image quality and the encoding amount. If theRD-Optimization method is used, for example, the method is applicablethat is disclosed in G, Sullivan and T. Wiegand: “Rate-DistortionOptimization for Video Compression”, IEEE Signal Processing Magazine,vol, 15, no. 6, pp, 74-90, 1998.

Next, the difference in prediction generated in the selected encodingmode is subjected to the frequency conversion (209) and the quantizationprocessing (1210), and is then subjected to variable-length encoding soas to generate an encoded stream (step 1211). In contrast, a frequencyconversion coefficient subjected to quantization undergoes reversequantization processing (step 1212) and reverse frequency conversionprocessing (step 1213) to decode the difference in prediction such thata decoded image is generated. The decoded image is then stored in thereference image memory (step 1214). If all blocks have been subjected tothe above processing, encoding of one image frame ends (step 1215).

FIG. 13 is a flowchart illustrating in detail the new intra predictionencoding processing (the step 1205). Here, for example, as shown withthe reference numeral 1101, the following processing is performed forall prediction directions defined beforehand (step 1301), and isperformed for all lines in each prediction direction (step 1302). To bemore specific, if a target block is located at the end of a screen (step1303), a boundary pixel is predicted, and the difference in predictionis calculated, according to the step 1 shown in FIG. 5 (step 1304). Incontrast, if the target block is not located at the end of the screen, aboundary pixel is predicted, and the difference in prediction iscalculated, according to the step 1 shown in FIG. 4 (step 1305).Subsequently, based on values of reference pixels included insurrounding blocks and values of the boundary pixels predicted by theabove steps, bidirectional prediction is performed according to the step2 shown in FIGS. 4 and 5 (step 1305). If the above processing for allprediction directions and all lines is completed, the predictionencoding processing for one block ends (step 1307).

FIG. 14 is a flowchart illustrating how to decode one frame by thedecode processing of the moving image decoding apparatus shown in FIG. 2according to the embodiment of the present invention. First, all blocksincluded in one frame are subjected to the following processing (step1401). To be more specific, an input stream is subjected tovariable-length decoding processing (step 1402), reverse quantizationprocessing (step 1403), and reverse frequency conversion processing(step 1404) such that the difference in prediction is decoded.Subsequently, according to the method having subjected the target blockto prediction encoding, new intra prediction decoding processing (step1407), old intra prediction decoding processing (step 1408), or interprediction decoding processing (step 1409) is executed to acquire adecoded image. The acquired decoded image is then stored in thereference image memory. If all blocks included in the one frame havebeen completely subjected to the above processing, decoding for the oneimage frame ends (step 1410).

FIG. 15 is a flowchart illustrating in detail the new intra predictiondecoding processing (the step 1407). Here, all lines in a predictiondirection are subjected to the following processing (step 1501). To bemore specific, if a target block is located at the end of a screen (step1402), a boundary pixel is predicted, and the difference in predictionis calculated, according to the step 1 shown in FIG. 8 (step 1403). Incontrast, if the target block is not located at the end of the screen, aboundary pixel is predicted, and the difference in prediction iscalculated, according to the step 1 shown in FIG. 7 (step 1404).Subsequently, based on values of reference pixels included insurrounding blocks and values of the boundary pixels predicted by theabove steps, bidirectional prediction is performed according to the step2 shown in FIGS. 7 and 8 (step 1405). If all lines have been completelysubjected to the above processing, the prediction encoding processingfor one block ends (step 1406).

In this embodiment, DCT is taken as an example of the frequencyconversion. However, any orthogonal transformation used for eliminationof correlation between pixels may also be adopted (for example, DST(Discrete Sine Transformation), WT (Wavelet Transformation), DFT(Discrete Fourier Transformation), or KLT (Karhunen-LoeveTransformation)). In particular, the difference in prediction itself mayalso be encoded without performing the frequency conversion. Moreover,the execution of variable-length encoding is not particularly required.In addition, this embodiment describes the case where luminancecomponents are predicted particularly on a block (4.times.4 pixel size)basis. However, this embodiment may also be applied to any size block(for example, 8.times.8 pixel size, and 16.times.16 pixel size).Further, this embodiment may also be applied not only to the predictionof luminance components, but also to the prediction of color differencecomponents Furthermore, according to this embodiment, the prediction isperformed in eight directions that are specified in the H.264/AVCstandards. However, the number of directions may also be increased ordecreased.

Next, an example of a prediction equation in this embodiment will bedescribed. Here, a case where luminance components are predicted on a4.times.4-pixel-size block basis will be described. First, as shown inFIG. 16 (1601), on the assumption that coordinates of a pixel located atthe upper leftmost of a target block are (0, 0), x axis is set on theright side in the horizontal direction, whereas y axis is set on thelower side in the vertical direction. Next, a luminance value atcoordinates (x, y) in a target block is expressed as P [x, y]; and apredicted value is expressed as pred4.times.4 [x, y]. In addition, tworeference pixels used for the bidirectional prediction are expressed asRef1, Ref2 respectively. Incidentally, a function Min (a, b) returns asmaller one of two integers a, b; and a function ROUND (a) returns aninteger value obtained by rounding off the first decimal place of a realnumber a.

Next, a case where prediction is performed in eight kinds of directionsexcluding DC prediction (1604) from among nine kinds of predictionmethods (1602) through (1610) will be described using an equation of apredicted value pred4.times.4.

When prediction is to be executed in a prediction direction 0 (Vertical)(1602), the prediction is performed by an equation 1 as follows:

(Equation 1)

a case where adjacent blocks located on the left and the upper side canbe used:Ref1=p[x,−1]Ref2=(p[−1,3]+p[−2,3]+p[−3,3]+p[−4,3]+2)>>2pred4.times.4[x,y]=ROUND(Ref1+(Ref2Ref1)(y+1)/4)

a case where although an adjacent block located on the upper side can beused, an adjacent block located on the left side cannot be used:Ref2=p[x,−1]Ref2=2p[x,−1]−p[x,−4]pred4.times.4[x,y]=ROUND(Ref1+(Ref2Ref1)(y+1)/4)

When prediction is to be executed in a prediction direction 1(Horizontal) (1603), the prediction is performed by an equation 2 asfollows:

(Equation 2)

a case where adjacent blocks located on the left and the upper side canbe used:Ref1=p[−1,y]Ref2=(p[3,−1]+p[3,−2]+p[3,−3]+p[3,−4]+2)>>2pred4.times.4[x,y]=ROUND(Ref1+(Ref2Ref1)(x+1)/4)

a case where although an adjacent block located on the left side can beused, an adjacent block located on the upper side cannot be used:Ref1=p[−1,y]Ref2=2p[−1,y]−p[−4,y]pred4.times.4[x,y]=ROUND(Ref1+(Ref2Ref1)(x+1)/4)

When prediction is to be executed in a prediction direction 3 (DiagonalDown Left) (1605), the prediction is performed by an equation 3 asfollows:

(Equation 3)

a case where adjacent blocks located on the left and the upper side canbe used:

when x=y=3Ref1=(p[6,−1]+3p[7,−1]+2)>>2Ref2=(p[−1,2]+3p[−1,3]+2)>>2pred4.times.4[x,y]=ROUND((Ref1+Ref2)/2)

for the other cases (more specifically, x is not equivalent to 3, and yis not equivalent to 3)Ref1=(p[x+y,−1]+2p[x+y+1,−1]+p[x+y+2,−1]+2)>>2Ref2=(p[−1,Min(3,x+y)]+2p[−1,Min(3,x+y+1)]+p[−1,Min(3,x+y+2)]+2)>>−2pred4.times.4[x,y]=ROUND(Ref1+(Ref2Ref1)(y+1)/(x+y+2))

a case where although an adjacent block located on the upper side can beused, an adjacent block located on the left side cannot be used:

when x=y=3Ref1=(p[6,−1]+3p[7,−1]+2)>>2Ref2=(p[3,−1]+p[3,−2]+p[3,−3]+p[3,−4]+2)>>2pred4.times.4[x,y]=ROUND((Ref1+Ref2)/2)

for the other cases (more specifically, x is not equivalent to 3, and yis not equivalent to 3)Ref1=(p[x+y,−1]+2p[x+y+1,−1]+p[x+y+2,−1]+2)>>2Ref2=(p[3,−1]+p[3,−2]+p[3,−3]+p[3,−4]+2)>>2pred4.times.4[x,y]=ROUND(Ref1+(Ref2Ref1)(y+1)/(x+y+2))

When prediction is to be executed in a prediction direction 4 (DiagonalDown Right) (1606), the prediction is performed by an equation 4 asfollows:

(Equation 4)

a case where adjacent blocks located on the left and the upper side canbe used:

when x>yRef1=(p[x−y−2,−1]+2p[x−y−1,−1]+p[x−y,−1]+2)>>2Ref2=(p[3,−1]+p[3,−2]+p[3,−3]+p[3,−4]+2)>>2pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)x/3)

when x<yRef1=(p[−1,y−x−2]+2p[−1,y−x−1]+p[−1,y−x]+2)>>2Ref2=(p[−1,3]+p[−2,3]+p[−3,3]+p[−4,3]+2)>>2pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)y/3)

when x=yRef1=(p[0,−1]+2p[−1,−1]+p[−1,0]+2)>>2Ref2=(p[3,−1]+p[3,−2]+p[−1,3]+p[−2,3]+2)>>2pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)(x+1)/4)

When prediction is to be executed in a prediction direction 5 (VerticalRight) (1607), the prediction is performed by an equation 5 as follows:

(Equation 5)

when zVR=2*xy,

a case where adjacent blocks located on the left and the upper side canbe used:

when zVR=0, 2, 4, 6Ref1=(p[x−(y>>1)−1,−1]+p[x−(y>>1),−1]+1)>>1Ref2=(p[−1,3]+p[−2,3]+p[−3,3]+p[−4,3]+2)>>2pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)(y+1)/4)

when zVR=1, 3, 5Ref1=(p[x−(y>>1)−2,−1]+2p[x−(y>>1)−1,−1]+p[x−(y>>1),−1−]+2)>>2Ref2=(p[−1,3]+p[−2,3]+p[−3,3]+p[−4,3]+2)>>2pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)(y+1)/4)

when zVR=−1Ref1=(p[−1,0]+2p[−1,−1]+p[0,−1]+2)>>2Ref2=(p[−1,3]+p[−2,3]+p[−3,3]+p[−4,3]+2)>>2pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)(y+1)/4)

for the other cases (more specifically, zVR=−2, −3)Ref1=(p[−1,y−1]+2p[−1,y−2]+p[1,y−3]+2)>>2Ref2=(p[−1,3]+p[−2,3]+p[−3,3]+p[−4,3]+2)>>2pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)(y+1)/4)

When prediction is to be executed in a prediction direction 6(Horizontal Down) (1608), the prediction is performed by an equation 6as follows:

(Equation 6)

when zHD=2*yx,

a case where adjacent blocks located on the left and the upper side canbe used:

when zHD=0, 2, 4, 6Ref1=(p[−1,y−(x>>1)−1]+p[−1,y−(x>>1)]+1)>>1Ref2=(p[3,−1]+p[3,−2]+p[−1,3]+p[−2,3]+2)>>2pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)(x+1)/4)

when zHD=1, 3, 5Ref1=(p[−1,y−(x>>1)−2]+2p[−1,y−(x>>1)−1]+p[−1,y−(x>>1)−]+2)>>2Ref2=(p[3,−1]+p[3,−2]+p[−1,3]+p[−2,3]+2)>>2pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)(x+1)/4)

when zHD=−1Ref1=(p[−1,0]+2p[−1,−1]+p[0,−1]+2)>>2Ref2=(p[3,−1]+p[3,−2]+p[−1,3]+p[−2,3]+2)>>2pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)(x+1)/4)

for the other cases (more specifically, zHD=−2, −3)Ref1=(p[x−1,−1]+2p[x−2,−1]+p[x−3,−1]+2)>>2Ref2=(p[3,−1]+p[3,−2]+p[−1,3]+p[−2,3]+2)>>2pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)(x+1)/4)

When prediction is to be executed in a prediction direction 7 (VerticalLeft) (1609), the prediction is performed by an equation 7 as follows:

(Equation 7)

a case where adjacent blocks located on the left and the upper side canbe used:

when y=0, 2Ref1=(p[x+(y>>1),−1]+p[x+(y>>1)+1,−1]+1)>>1Ref2=(p[−1,3]+p[−2,3]+p[−3,3]+p[−4,3]+2)>>2pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)(y+1)/(x+y+2))

for the other cases (more specifically, y=1, 3)Ref1=(p[x+(y>>1),−1]+2p[x+(y>>1))+1,−1]+p[x+(y>>1)+2,−1]+2)>>2Ref2=(p[−1,3]+p[−2,3]+p[−3,3]+p[−4,3]+2)>>2pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)(y+1)/(x+y+2))

a case where although an adjacent block located on the upper side can beused, an adjacent block located on the left side cannot be used:

when y=0, 2Ref1=(p[x+(y>>1),−1]+p[x+(y>>1)+1,−1]+1)>>1Ref2=2p[x,−1]−p[x,−4]pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)(y+1)/(x+y+2))

for the other cases (more specifically, y=1, 3)Ref1=(p[x+(y>>1),−1]+2p[x+(y>>1)+1,−1]+p[x+(y>>1)+2,−1−]+2)>>2Ref2=2p[x,−1]−p[x,−4]pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)(y+1)/(x+y+2))

When prediction is to be executed in a prediction direction 8(Horizontal Up) (1610), the prediction is performed by an equation 8 asfollows:

(Equation 8)

when zHU=x+2*y,

a case where adjacent blocks located on the left and the upper side canbe used:

when zHU=0, 2, 4Ref1=(p[−1,y+(x>>1)]+p[−1,y+(x>>1)+1]+1)>>1Ref2=(p[3,−1]+p[3,−2]+p[−1,3]+p[−2,3]+2)>>2pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)(x+1)/4)

when zHU=1, 3Ref1=(p[−1,y+(x>>1)]+2p[−1,y+(x>>1)+1]+p[−1,y+(x>>1)+2−]+2)>>2Ref2=(p[3,−1]+p[3,−2]+p[−1,3]+p[−2,3]+2)>>2pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)(x+1)/4)

when zHU=5Ref1=(p[−1,2]+3p[−1,3]+2)>>2Ref2=(p[3,−1]+p[3,−2]+p[−1,3]+p[−2,3]+2)>>2pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)(x+1)/4)

for the other cases (more specifically, zHU>5)Ref1=p[−1,3]Ref2=(p[3,−1]+p[3,−2]+p[−1,3]+p[−2,3]+2)>>2pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)(x+1)/4)

a case where although an adjacent block located on the left side can beused, an adjacent block located on the upper side cannot be used:

a case where zHU=0, 2, 4Ref1=(p[−1,y+(x>>1)]+p[−1,y+(x>>1)+1]+1)>>1Ref2=2p[−1,y]−p[−4,y]pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)(x+1)/4)

when zHU=1, 3Ref1=(p[−1,y+(x>>1)]+2p[−1,y+(x>>1)+1]+p[−1,y+(x>>1)+2−]+2)>>2Ref2=2p[−1,y]−p[−4,y]pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)(x+1)/4)

when zHU=5Ref1=(p[−1,2]+3p[−1,3]+2)>>2Ref2=2p[−1,y]−p[−4,y]pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)(x+1)/4)

for the other cases (more specifically, zHU>5)Ref1=(p[−1,3]Ref2=2p[−1,y]−p[−4,y]pred4.times.4[x,y]=ROUND(Ref1+(Ref2−Ref1)(x+1)/4)

In the embodiment described above, when two reference pixels are used,prediction of pixels which cannot be selected from encoded (decoded)pixels (for example, prediction of boundary pixels E, F, G, H in thestep 1 shown in FIG. 4) is mainly performed by an average value ofpixels belonging to the same row (or the same column) of encodedadjacent blocks. However, the above-described prediction does not needalways the average value. For example, a minimum value, a maximum value,and a median value may also be used. In addition, any kind ofcalculating formula (for example, extrapolative prediction (orinterpolative prediction) using these pixels) may also be used. Inparticular, when the interpolative prediction is performed, any kind ofmethod (for example, linear interpolation, and nonlinear interpolation)may also be used. On the other hand, when the extrapolative predictionis performed, any kind of model (for example, straight line/parabolaapproximation using the least-squares method, the Newton'sinterpolation, and the Lagrange interpolation) may also be used toperform the prediction.

FIG. 17 is a conceptual diagram illustrating a case where the boundarypixels E, F, G, H are predicted by the extrapolative prediction in thestep 1 (402) shown in FIG. 4. Here, a horizontal axis indicatescoordinates, whereas a vertical axis indicates a luminance value.Reference numeral 1701 shows a case where the straight-lineapproximation is performed. A predicted straight row is calculated basedon, for example, the least-squares method by using decoded pixels A′,B′, C′, D′ located in the lowermost line of an adjacent block located onthe left side. Points corresponding to coordinates of boundary pixels E,F, G, H in the straight line are used as predicted values. In addition,reference numeral 1702 shows a case where the same extrapolativeprediction is performed by curve approximation including the parabolaapproximation, the Newton's interpolation, and the Lagrangeinterpolation. In this case, boundary pixels E, F, G, H are predicted onthe basis of a predicted curve calculated by use of decoded pixels A′,B′, C′, D′. The boundary pixels predicted by the above processing areused as one of reference pixels, for example, when bidirectionalprediction in the step 2 shown in FIG. 4 is performed.

In addition, information used for the prediction of reference pixels isnot particularly limited to pixels belonging to the same row (or column)so long as it is information about adjacent blocks. Moreover, accordingto this embodiment, the bidirectional prediction (for example,prediction of pixels J, K, L in the step 2 shown in FIG. 4) is performedby the linear interpolation that uses two reference pixels. However, theinterpolation method thereof is not particularly limited so long as atarget pixel is located between the two reference pixels to be used. Forexample, a predicted value of the target pixel may also be expressed byany straight-line equation of two reference pixels. In this case, on theassumption that two reference pixels are defined as Ref1, Ref2, apredicted value pred4.times.4 is calculated by an equation 9 as follows:pred4.times.4[x,y]=aRef1+b+Ref2  (Equation 9)

Here, each of a, b represents a constant that is a real number. Thesevalues may also be defined as predetermined values, or may also bespecified on a block basis. In addition, blocks to which the intraprediction encoding method (decoding method) used for the screen endshown in FIG. 5 (FIG. 8) can be applied are not particularly limited toblocks located at the screen end. In other words, this method may alsobe applied to blocks other than the blocks located at the screen end.

FIG. 18 is a diagram illustrating a configuration example of an encodedstream generated according to this embodiment, the diagram mainlyshowing encoding parameters that should be set on a block basis. Here,as is the case with the unit of processing based on the H.264/AVC, anencoding mode is determined on a fixed-length macro block basis. Eachmacro block can be further divided into smaller blocks. Predictionencoding shall be performed on a divided block basis. In this case,information is encoded in variable-length, and is then stored. Theinformation to be subjected to encoding includes: a macro block number(1801) used to identify coordinates on a macro block basis; an encodingmode number (1802) that indicates a prediction method and the blocksize; information required for prediction (1803) including, for example,a motion vector at the time of inter prediction, and a predictiondirection at the time of intra prediction; and information aboutdifference in prediction (1804). In particular, the encoding mode number(1802) may also be serially assigned to all prediction means, or mayalso be expressed with different bits on a prediction means basis.

FIG. 19 is a diagram illustrating another configuration example of anencoded stream generated according to this embodiment shown in FIG. 18,the diagram mainly showing encoding parameters that should be set on ablock basis. This configuration example includes: a macro block number(1901); a prediction method (1902); a flag (1903) indicating whether ornot to perform prediction using an adjacent pixel according to thisembodiment; informational required for prediction (1904); andinformation about difference in prediction (1905).

While we have shown and described several embodiments in accordance withour invention, it should be understood that disclosed embodiments aresusceptible of changes and modifications without departing from thescope of the invention. Therefore, we do not intend to be bound by thedetails shown and described herein but intend to cover all such changesand modifications as fall within the ambit of the appended claims.

What is claimed is:
 1. An image decoding method that decodes an image byperforming prediction processing, comprising: a prediction modeselection step, which selects one of a plurality of prediction modes forthe prediction processing; and a prediction step, which performs theprediction processing of the prediction mode selected at the predictionmode selection step, wherein the prediction modes selectable at theprediction mode selection step include: a first intra prediction mode inwhich first reference pixels are generated as prediction pixels at alocation where no decoded pixel exists employing pixels within a decodedblock adjacent to one of left and upper sides of a target block to bedecoded, at calculation processing of prediction values of target pixelsto be decoded which are disposed between two reference pixels, namely,decoded second reference pixels adjacent to one of the upper and leftsides of the target block to be decoded which is a different side fromthe first reference pixels and the first reference pixels, computationbeing performed employing values of the second reference pixels andvalues of the first reference pixels; and a second intra prediction modewhich is different from the first intra prediction mode and in whichprediction pixels are generated employing values of the decoded pixelsadjacent to the target block to be decoded, wherein there is a state inthe first intra prediction mode in which the calculation processing ofthe prediction pixels employing the computation is feasible for anypixels excepting all boundary pixels located at a lower end of thetarget block to be decoded within the target block to be decoded,wherein a unidirectional prediction is performed towards a directiondesignated by an encoding side based on the decoded pixels employing thevalues of the pixels within the decoded block at the second intraprediction mode, and wherein a processing order of target blocks to bedecoded does not change irrespectively of whether the first intraprediction mode or the second intra prediction mode is selected at theprediction mode selection step.